<?php

namespace App\Service;

use Storage;

class ServiceLog
{
    public static function record($filename, $fileData, $dir)
    {
        $date = date("y-m-d");
		$time = date("Y-m-d H:i:s");
        $file_path = "/{$dir}/{$date}/".$filename;
        if(is_array($fileData)){
        	$fileData = json_encode($fileData);
        }
		$fileData = "[{$time}]"."\n".$fileData;
        Storage::append($file_path,$fileData);
    }
}